package cn.rongdao.jrkabao.ui.loan.uicomponent;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mifengkong.frtools.util.FRString;

import cn.rongdao.jrkabao.R;


/**
 * Created by jack on 17/5/18
 */

public class ApplySuccessHeaderUIComponent extends LinearLayout {


    public ApplySuccessHeaderUIComponent(Context context) {
        super(context);
    }

    public ApplySuccessHeaderUIComponent(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public ApplySuccessHeaderUIComponent(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private ImageView ivAvatar;
    private TextView tvTitle;
    private TextView tvContent;

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        ivAvatar = (ImageView) findViewById(R.id.last_iv_avatar);
        tvTitle = (TextView) findViewById(R.id.last_tv_title);
        tvContent = (TextView) findViewById(R.id.last_tv_content);
    }

    public void setContent(String verifyStatusCode, String title, String content) {
        setVisibility(View.VISIBLE);
        setTextContent(title, content);
        switch (verifyStatusCode) {
            case "apply_success":
                ivAvatar.setImageResource(R.drawable.icon_apply_success);
        }
    }


    private void setTextContent(String title, String content) {
        tvTitle.setText(FRString.valueOf(title));
        tvContent.setText(FRString.valueOf(content));
    }

}